package dao;

public class MyStaticProxy {

    private GeneralDao generalDao;

    public MyStaticProxy(GeneralDao generalDao) {
        this.generalDao = generalDao;
    }

    public void insert(){
        begin();
        generalDao.insert();
        commit();
    }

    public void delete(){
        begin();
        generalDao.delete();
        commit();
    }

    public void update(){
        begin();
        generalDao.update();
        commit();
    }

    public void begin(){
        System.out.println("开启事务");
    }

    public void commit(){
        System.out.println("提交事务");

    }
}
